setTimeout(() => {
  console.log('timeout 1');
})

new Promise(resolve =>{
  console.log('resolve');
  resolve()
}).then(() => {
  console.log('the');
})

console.log('script end');


/*
输出顺序: 
1. resolve
2. script end
3. the 
4. timeout 1

*/

/**
 * 同步任务: log  Promise.resolve Promise.reject
 * 微任务: .then
 * 宏任务 setTimeout setInterval
 */


let i = 0

setTimeout(()=>{
  console.log(++i);
}, 1000)

setTimeout(()=>{
  console.log(++i);
}, 1000)


